﻿#pragma once

#include "Const.h"

// 游戏
class Game {
    // 状态
    public: enum Status {
        END,    // 已结束
        PLAYING // 游戏中
    };

    private: CWnd* mCallback;   // 回调
    private: CDC* mDrawer;      // 绘图者
    private: CFont mFont;       // 字体
    private: CWnd* mGameBoard;  // 游戏区域
    private: int mNumbers[Const::GAME_BOARD_GRID_COUNT_V][Const::GAME_BOARD_GRID_COUNT_H];  // 数字矩阵
    private: Status mStatus;    // 状态

    public: Game(CWnd*, CDC*, CWnd*);
    private: void AfterMove(BOOL);
    private: void CreateRandomNumber();
    private: void DrawAllNumbers();
    private: void DrawGameBoard();
    private: void DrawOneNumber(int, int, int);
    private: void GameOver(BOOL);
    private: BOOL IsLost();
    private: BOOL IsWon();
    private: void MoveDown();
    private: void MoveLeft();
    private: void MoveRight();
    private: void MoveUp();
    public: BOOL OnKeyPressed(UINT);
    public: void Start();
};
